package com.xl.studentpass.entity.po;

import com.baomidou.mybatisplus.annotation.TableName;
import com.xl.studentpass.utils.LocalDateUtils;

import java.math.BigDecimal;
import java.util.List;

/**
 * @author: xl
 * @createTime: 2023/5/28 08:47:24
 * @program: student-pass
 * @e-mail: 2199396150@qq.com
 * @description:
 */
@TableName("t_task_info")
public class TaskOverViewPo {
    private Integer id;
    private BigDecimal taskPrice;
    private BigDecimal originalPrice;

    private Integer userId;
    private Integer categoryId;
    private String taskName;
    private String taskInfo;

    private String createTime;
    private String expirationTime;
    private Long validSeconds;

    private List<String> imageUrls;

    public BigDecimal getOriginalPrice() {
        return originalPrice;
    }

    public void setOriginalPrice(BigDecimal originalPrice) {
        this.originalPrice = originalPrice;
    }


    public TaskOverViewPo(Integer id, BigDecimal taskPrice, Integer userId, Integer categoryId, String orderName, String createTime, String validTime) {
        this.id = id;
        this.taskPrice = taskPrice;
        this.userId = userId;
        this.categoryId = categoryId;
        this.taskName = orderName;
        this.createTime = createTime;
        this.expirationTime = validTime;
    }

    public List<String> getImageUrls() {
        return imageUrls;
    }

    public void setImageUrls(List<String> imageUrls) {
        this.imageUrls = imageUrls;
    }

    public String getTaskInfo() {
        return taskInfo;
    }

    public void setTaskInfo(String taskInfo) {
        this.taskInfo = taskInfo;
    }


    public void setValidSeconds() {
        //当前时间信息
        String localDateTimeStr = LocalDateUtils.getLocalDateTimeStr();

        this.validSeconds = LocalDateUtils.getValidTimeSeconds(localDateTimeStr, expirationTime);
    }

    public Long getValidSeconds() {
        return validSeconds;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public BigDecimal getTaskPrice() {
        return taskPrice;
    }

    public void setTaskPrice(BigDecimal taskPrice) {
        this.taskPrice = taskPrice;
    }

    public Integer getUserId() {
        return userId;
    }

    public void setUserId(Integer userId) {
        this.userId = userId;
    }

    public Integer getCategoryId() {
        return categoryId;
    }

    public void setCategoryId(Integer categoryId) {
        this.categoryId = categoryId;
    }

    public String getTaskName() {
        return taskName;
    }

    public void setTaskName(String taskName) {
        this.taskName = taskName;
    }

    public String getCreateTime() {
        return createTime;
    }

    public void setCreateTime(String createTime) {
        this.createTime = createTime;
    }

    public String getExpirationTime() {
        return expirationTime;
    }

    public void setExpirationTime(String expirationTime) {
        this.expirationTime = expirationTime;
        setValidSeconds();
    }

    @Override
    public String toString() {
        return "{" +
                "id:" + id +
                ", taskPrice:" + taskPrice +
                ", userId:" + userId +
                ", categoryId:" + categoryId +
                ", taskName:'" + taskName + '\'' +
                ", createTime:'" + createTime + '\'' +
                ", expirationTime:'" + expirationTime + '\'' +
                ", validSeconds:" + validSeconds +
                '}';
    }
}
